home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.20000217-20000824 / 000040_news@columbia.edu _Wed Feb 23 13:40:31 2000.msg < prev    next >
Internet Message Format  |  2020-01-01  |  2KB

  1. Return-Path: <news@columbia.edu>
  2. Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.59.30])
  3.     by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id NAA05463
  4.     for <kermit.misc@watsun.cc.columbia.edu>; Wed, 23 Feb 2000 13:40:31 -0500 (EST)
  5. Received: (from news@localhost)
  6.     by newsmaster.cc.columbia.edu (8.9.3/8.9.3) id NAA22464
  7.     for kermit.misc@watsun.cc.columbia.edu; Wed, 23 Feb 2000 13:13:27 -0500 (EST)
  8. X-Authentication-Warning: newsmaster.cc.columbia.edu: news set sender to <news> using -f
  9. From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
  10. Subject: Re: Array name passed to macro as argument?
  11. Date: 23 Feb 2000 18:13:25 GMT
  12. Organization: Columbia University
  13. Message-ID: <891805$ltt$1@newsmaster.cc.columbia.edu>
  14. To: kermit.misc@columbia.edu
  15.  
  16. In article <8915uc$4e2$1@nnrp1.deja.com>,
  17. Peter Easthope  <peter_easthope@gulfnet.pinc.com> wrote:
  18. : In <88u9fb$ev5$1@newsmaster.cc.columbia.edu>
  19. : posted at 22 Feb 2000 15:20:11 GMT Frank da Cruz said,
  20. : fdc> ... in C-Kermit 7.0 / K95 1.1.19, you can write this more
  21. : simply ... declare \&d[] = Sea urchin.
  22. : Thanks Frank.  It is in my memory banks for future
  23. : use.  The current application is meant to run on MS-DOS
  24. : Kermit also; for now I will retain the more primitive
  25. : notation to declare the array.
  26. : fdc> Here's a version of your Test macro that works:
  27. :   def test {
  28. :     local \%x
  29. :     .\%x := \\&\%1[1]
  30. :     echo {\%x}
  31. :     .\%x := \\&\%1[2]
  32. :     echo {\%x}
  33. :   }
  34. : MS-DOS Kermit complains: "?More parameters are needed".
  35. : What does the "." in ".\%x" mean?  What
  36. : documentation is recommended for these details?
  37. That's a new "programmer friendly" assignment notation, but
  38. it only works in K95 and C-Kermit.
  39.  
  40. OK, here's another way that works in MS-DOS Kermit 3.15, as
  41. well as in K95 and C-Kermit:
  42.  
  43.   def arraytest {                ; Define macro
  44.     local \%x
  45.     assign \%x \\\%1[1]
  46.     echo {\%x}
  47.     assign \%x \\\%1[2]
  48.     echo {\%x}
  49.   }
  50.   declare \&a[10]                 ; Set up array
  51.   assign \&a[1] one
  52.   assign \&a[2] two
  53.   assign \&a[3] three
  54.  
  55.   arraytest &a                    ; Call macro with array name.
  56.  
  57. Note that TEST is a built-in command in MS-DOS Kermit.  Backslash
  58. craziness is avoided by passing the array name to the macro sans
  59. backslash.  The statement:
  60.  
  61.   assign \%x \\\%1[1]
  62.  
  63. constructs the string \&a[1] and assigns it to \%x.
  64.  
  65. - Frank